package tests;

import static org.junit.Assert.assertTrue;

import java.util.ArrayList;

import org.junit.Test;

import utils.Node;
import utils.TreeUtils;

public class LeavesTest {

	@Test
	public final void testGetLeaves() {

		Node tree = new Node(1, "salut", null, null);
		Node n1 = new Node(2, "buna", tree, null);
		Node n2 = new Node(3, "buna1", n1, null);
		Node n3 = new Node(4, "buna2", n1, null);
		Node n4 = new Node(5, "buna", tree, null);

		tree.children.add(n1);
		tree.children.add(n4);
		
		n1.children.add(n2);
		n1.children.add(n3);
		
		ArrayList<Node> list = TreeUtils.getLeaves(tree);
		assertTrue(list != null);
		
		System.out.println("Leaves:");
		for (Node n: list)
			System.out.println(n);
		
		list = TreeUtils.getIntermediateNodes(tree);
		assertTrue(list != null);
		
		System.out.println("Intermediate:");
		for (Node n: list)
			System.out.println(n);

	}
}
